import React from 'react'
import PropTypes from 'prop-types'

function Dialog(props) {
    let { title='温馨提示', content, children } = props
    children = React.Children.toArray(children)
    return (
        <div className='dialog-box'>
            <div className="header">
                <h2 className='title'>{title}</h2>
                <span></span>
            </div>
            <div className="main">
                {content}
            </div>
            {children.length > 0 ?
                <div className="footer">{children}</div> : null
            }
        </div>
    )
}


Dialog.propTypes = {
    title: PropTypes.string.isRequired,
    content: PropTypes.string.isRequired
}

export default Dialog